home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / magazine / progjour / 1991 / 06 / alib / strcpy_l.asm < prev    next >
Assembly Source File  |  1991-06-25  |  437b  |  31 lines

  1.     include    asm.inc
  2.  
  3.     public    strcpy_limit
  4.  
  5.     .code
  6.  
  7. ;;    strcpy limit
  8. ;
  9. ;    entry    DS:SI    source pointer
  10. ;        ES:DI    destination pointer
  11. ;        DX    destination limit
  12. ;    exit    DI    updated to last character in destination
  13. ;    uses    AX
  14. ;
  15. strcpy_limit proc
  16.     push    si
  17. scl1:    cmp    di,dx
  18.     jae    scl2            ; if at destination limit
  19.  
  20.     lodsb                ; else copy one character
  21.     stosb
  22.     cmp    al,0
  23.     jne    scl1
  24.  
  25.     dec    di
  26. scl2:    pop    si
  27.     ret
  28. strcpy_limit endp
  29.  
  30.     end
  31.